package com.novellotus.iov.carvice.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.novellotus.iov.carvice.bean.MqttVehicleBean;
import com.novellotus.iov.carvice.bean.RxCarData;

import butterknife.ButterKnife;

/**
 * Created by Rich on 2017/7/26.
 */

public abstract class BaseCarFragment extends Fragment {

    CarFragmentInterface carFragmentInterface;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return initRootView(inflater, container, savedInstanceState);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ButterKnife.bind(this, view);
        init();
    }

    abstract View initRootView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState);

    abstract void init();

    public abstract String getPlate();

    public abstract String getVin();

    public abstract String getModel();

    /**
     * 0离线 1在线 2充电 3报警
     */
    public abstract int getType(RxCarData rxCarData);

    public abstract void setData(RxCarData rxCarData);

    public abstract void setInterface(CarFragmentInterface carFragmentInterface);

    public abstract void mqttUpdate(MqttVehicleBean mqttVehicleBean,int carType,int detailType);

    public interface CarFragmentInterface {
        void loadStatue(int statue);
    }

}
